package cn.com.qingz.core.exception;

import org.apache.log4j.Logger;
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;

import cn.com.qingz.core.utils.PrintExpJsonUtils;

/**
 * 所有异常转换为JSON串返回给客户端.
 * @author jiulong.hu
 *
 */
public class MySimpleMappingExceptionResolver extends
		SimpleMappingExceptionResolver {//HandlerExceptionResolver  
	private Logger log = Logger.getLogger(MySimpleMappingExceptionResolver.class);

	protected org.springframework.web.servlet.ModelAndView doResolveException(//HandlerExceptionResolver  
			javax.servlet.http.HttpServletRequest request,
			javax.servlet.http.HttpServletResponse response, Object obj,
			Exception e) {
	//	e.printStackTrace();
		log.error("系统内部异常", e);
	//	log.error(e,e.getCause().fillInStackTrace());
		PrintExpJsonUtils.printExpJson(response, e);
		return null;
	};
}
